﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HotelWebservice;
using HotelWebservice.HotelWebservice;
using System.Data;

/*

 * 网页风格请参考：http://www.airbnb.com/rooms/new
 * 
*/

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[QueryStrings.Uid]== null )
        {
            Response.Redirect("login3.aspx");
        }
  
        

    }
    protected void Button1_Click ( object sender , EventArgs e )
    {

       

    }



    Hs hs;
    Hs Hs
    {
        get
        {
            if (hs == null)
            {
                hs = new Hs();
            }
            return hs;  
        }
    }




    protected void Button1_Click1(object sender, EventArgs e)
    {
        
       this.Button1.Text = this.Request.Form["bedRooms"].ToString()    + this.Request.Form["apt"].ToString()
           ;

       string address = this.Request.Form["apt"].ToString();



       RoomInternal ri = new RoomInternal();



       ri.床数 = Cbank.Int.Parse(this.Request.Form["beds"].ToString());


       //todo:以下增加床型等内容

       ri.apt = this.Request.Form["apt"].ToString();
       ri.房屋类型 = (房屋类型)Cbank.Int.Parse(this.Request.Form["propertyType"].ToString());

       ri.房间类型 = (房间类型)Cbank.Int.Parse(this.Request.Form["privacy"].ToString());

       ri.卧室数 = Cbank.Int.Parse(this.Request.Form["bedRooms"].ToString());

       ri.可住人数 = Cbank.Int.Parse(this.Request.Form["accommodates"].ToString());
       ri.床型 = (床型)Cbank.Int.Parse(this.Request.Form["bedType"].ToString());


       ri.床数 = Cbank.Int.Parse(this.Request.Form["beds"].ToString());
       ri.房间标题 = this.Request.Form["title"].ToString();


       ri.币种 = 币种.CNY;

       ri.Price = Cbank.Double.Parse(this.Request.Form["pricePerNight"].ToString());




        //增加
    LoginReturn lr =   Hs.Juba_Category_Add (ri,
           Cbank.Int.Parse(Session[QueryStrings.Uid])
           , Hs.adminpass
           );

       this.Button1.Text = "保存成功。房间编号：" + lr.ErrorValue +"请进行下一步";
       this.Button1.Enabled = false;



        //允许下一步
       this.Button2.Enabled = true ;
       this.JubaCateGoryId = Cbank.Int.Parse(lr.ErrorValue);

    }

    int JubaCateGoryId = 0;

    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("editroomEnv.aspx?id=" + JubaCateGoryId.ToString());

    }
}